<template>
  <!-- 明细页面弹出框-->
  <el-dialog
    title="行名行号变更通知查询明细"
    center
    :visible.sync="open"
    width="1024px"
    :close-on-click-modal="true"
    @close="closeFn"
  >
    <ht-table
      ref="dataTable"
      :showSerialNumber="false"
      :multi-select="false"
      :initData="false"
      :dictMap="dictMap"
      :reqConfig="reqConfig"
      :queryParams="queryParams"
      :tableBindColumns="tableBindColumns"
      defaultEventKey="detailsTable"
      style="height: 240px"
    >
      <template v-slot:operate>
        <el-table-column label="操作" align="center" width="120" fixed="right" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <ht-button-group
              :buttonList="[
                {
                  label: '明细',
                  // permission: 'user:xxx:xxx',
                  doFunc: () => {
                    handleAction('detials', scope.row);
                  },
                },
              ]"
            />
          </template>
        </el-table-column>
      </template>
    </ht-table>
    <div slot="footer" class="dialog-footer">
      <el-button @click="closeFn">关闭</el-button>
    </div>
    <!-- 明细弹出框 -->
    <details-dialog ref="detailsDialog" :dictMap="dictMap" :formData.sync="formData"></details-dialog>
  </el-dialog>
</template>
<script>
import { detailsApiUrlConfig, detailsQuery } from "@/api/cnaps/ccms/913/bank_code_change_noti_query.js";
import DetailsDialog from "./bankCodeChangeInnerDetails";

export default {
  name: "bankCodeChangeDetails",
  components: { DetailsDialog },

  props: {
    dictMap: {
      type: Object,
      default: () => {
        return {};
      },
    },
    id: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      reqConfig: detailsApiUrlConfig,
      // 查询参数
      queryParams: {
        id: "",
      },
      formData: {},
      tableBindColumns: [
        { label: `交易流水号`, prop: "id", width: "250", align: "center" },
        {
          label: `变更类型`,
          prop: "chgType",
          width: "120",
          align: "center",
          dictCode: "CHANGECODE",
        },
        {
          label: `生效类型`,
          prop: "effectType",
          width: "120",
          align: "center",
          dictCode: "EFFECTIVECODE",
        },
        {
          label: `生效日期`,
          prop: "effectDate",
          width: "150",
          align: "center",
          type: "date",
        },
        {
          label: `失效日期`,
          prop: "invDate",
          width: "150",
          align: "center",
          type: "date",
        },
        {
          label: `参与机构行号`,
          prop: "bankCode",
          width: "200",
          align: "center",
        },
        {
          label: `行别代码`,
          prop: "category",
          width: "200",
          align: "center",
        },
      ],
      // 是否显示弹出层
      open: false,
    };
  },
  mounted() {},
  watch: {
    open(d) {
      if (d) {
        this.$nextTick(() => {
          this.$set(this.queryParams, "id", this.id);
          this.$refs.dataTable.doQuery();
        });
      }
    },
  },
  methods: {
    /** 明细按钮操作 */
    handleAction(type, row) {
      switch (type) {
        case "detials":
          // 明细信息
          detailsQuery(row).then((res) => {
            this.formData = res.result;
          });
          this.$refs.detailsDialog.show();
          break;
      }
    },
    // 表单重置
    reset() {
      this.resetForm("logForm");
    },
    closeFn() {
      this.open = false;
    },
    show() {
      this.open = true;
    },
    cancel() {
      this.open = false;
      this.reset();
    },
  },
};
</script>
